MergeSorted Generic Method

Wintellect PowerCollections

Collapse imageExpand ImageCollapseAll imageExpandAll imageDropDown imageDropDownHover imageCopy imageCopyHover image
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Merge several sorted collections into a single sorted collection. Each input collection must be sorted by the ordering in the passed instance of IComparer<T>. The merging is stable; equal items maintain their ordering, and equal items in different collections are placed in the order of the collections.

Namespace: Wintellect.PowerCollections
Assembly:  PowerCollections (in PowerCollections.dll)

Syntax

C#
public static IEnumerable<T> MergeSorted<T>(
	IComparer<T> comparer,
	params IEnumerable<T>[] collections
)
Visual Basic (Declaration)
Public Shared Function MergeSorted(Of T) ( _
	comparer As IComparer(Of T), _
	ParamArray collections As IEnumerable(Of T)() _
) As IEnumerable(Of T)
Visual C++
public:
generic<typename T>
static IEnumerable<T>^ MergeSorted (
	IComparer<T>^ comparer, 
	... array<IEnumerable<T>^>^ collections
)

Parameters

comparer
IComparer<(Of <T>)>
The comparer instance used to sort the list. Only the Compare method is used.
collections
array<IEnumerable<(Of <T>)>>[]()
The set of collections to merge. In many languages, this parameter can be specified as several individual parameters.

Return Value

An IEnumerable<T> that enumerates all the items in all the collections in sorted order.

Type Parameters

T

See Also